package gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;

public class About extends JFrame
{

   /**
    * 
    */
   private static final long serialVersionUID = 1L;

   /**
    * Create the frame.
    */
   public About()
   {
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      setBounds(100, 100, 400, 550);
      setResizable(false);

      JEditorPane top = new JEditorPane();
      top.setForeground(Color.BLACK);
      top.setEditable(false);
      top.setFont(new Font("Dialog", Font.BOLD | Font.ITALIC, 18));
      top.setText("   Save Connection Cost 1.0.1");

      ImagePanel logo = new ImagePanel(new ImageIcon("icons/logo.png").getImage());

      JScrollPane scrpane = new JScrollPane();


      //      JEditorPane text = new JEditorPane();
      JTextArea text = new JTextArea();
      text.setEditable(false);
      scrpane.getViewport().add(text);
      scrpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      scrpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
      text.setText("\n" +
            "Save Connection Costs\n"+"Version: 1.0.1 \n"+
            "\n(c) Copyright SCC contributors and others 2011." +
            "\n All rights reserved. \n" +
            "\n Save Connection Costs is a software project \n" +
            "aimed at the general public as well an engineers\n" +
            "people. The application built using well-know \n" +
            "engineering algorithms to solve the weighted \n" +
            "graph problem. The main feature of this \n" +
            "application, to solve the minimum spanning tree \n" +
            "(MST) and travelings salesman problem (TSP)\n" +
            "\nThe application allows users to design their own\n" +
            "weighted graph problem and each problem will need\n" +
            "to have  nodes and the connector cost between \n" +
            "individual node. Once the weighted graph created\n" +
            " then the software can solve neither the minimum \n" +
            "spanning tree or traveling salesman problem.\n" +
            "The benefit of using this software are:\n"+
            "Solving MST and TSP problems in an instance \n" +
            "Users do not needed to how the algorithms worked\n" +
            "Users can learn how the algorithm through small\n " +
            "weighted graph problems");

      JPanel content = new JPanel();
      content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS));
      content.add(top);
      content.add(logo);
      content.add(scrpane);

      JPanel buttons = new JPanel();
      buttons.setLayout(new FlowLayout(FlowLayout.CENTER));

      JButton close = new JButton("Close");
      close.addActionListener(new ActionListener()
      {

         @Override
         public void actionPerformed(ActionEvent e)
         {
            dispose();

         }
      });

      JButton lic = new JButton("License");
      lic.addActionListener(new ActionListener()
      {

         @Override
         public void actionPerformed(ActionEvent e)
         {
            // TODO Auto-generated method stub
            License lic = new License();
            lic.setVisible(true);
         }
      });
      buttons.add(lic);
      buttons.add(close);


      this.getContentPane().add(content, BorderLayout.CENTER);
      this.getContentPane().add(buttons, BorderLayout.SOUTH);
      this.getContentPane().setBackground(Color.WHITE);





   }


}
